#include "AutoLock.hh"

AutoLock::AutoLock(Lock* Key)
{
	AutoKey = Key;
	checkNullFV(AutoKey, "AutoKey is NULL.");
	
	ResultOf Result;
	Result = AutoKey->lock();
	checkErrorWOR(Result, "Fail AutoKey->lock.");
}

AutoLock::~AutoLock()
{
	ResultOf Result;
	if (AutoKey != NULL)
	{
		Result = AutoKey->unlock();
		checkErrorWOR(Result, "Fail AutoKey->unlock.");
	}
}